package Test517;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class Text {
    public static void main(String[] args) {
        Emp emp1 = new Emp("1001", "武则天", 30);
//        System.out.println(emp1);
        Emp emp2 = new Emp("1002", "李白", 25);
        Emp emp3 = new Emp("1003", "嫦娥", 21);

        List<Emp> list = new ArrayList();
        list.add(emp1);
        list.add(emp2);
        list.add(emp3);


//        for (int i = 0; i < list.size(); i++){
//            System.out.println(list.get(i));
//        }
        System.out.println("请输入用户名：");
        Scanner sc = new Scanner(System.in);
        String username = sc.next();
        for (int i = 0; i < list.size(); i++){
            if(username.equals(list.get(i).getName())){
                System.out.println(list.get(i));
            }
        }
    }
}
